<?php

namespace app\models;

use yii\db\ActiveRecord;

/**
 * 代理商收益
 * Class AgentProfit
 * @package app\models
 *
 * @property integer $id PK
 * @property integer $agent_id 代理商编号
 * @property integer $user_card_recharge_id 用户卡充值编号
 * @property integer $money 金额
 * @property integer $create_time 创建时间
 *
 * @property Agent $agent 关联代理商
 */
class AgentProfit extends ActiveRecord
{
    /**
     * 关联代理商
     * @return \yii\db\ActiveQuery
     */
    public function getAgent()
    {
        return $this->hasOne(Agent::class, ['id' => 'agent_id']);
    }

    //关联套餐
    public function getPackage(){
    	return $this->hasOne(Package::class, ['id' => 'package_id']);
    }
    //关联充值记录
   	public function getRecharge(){
   		return $this->hasOne(UserCardRecharge::class, ['id' => 'user_card_recharge_id']);
   	}
    //关联卡信息
    public function getCard(){
        return $this->hasOne(Card::class,['id'=> 'card_id']);
    }
}
